package service.impl;

import bean.pojo.Products;
import dao.ProductDao;
import dao.impl.ProductDaoImpl;
import service.ProductService;

import java.util.List;

/**
 * service.impl
 * User: 李雨行
 * Date: 2024/12/17 15:35
 * motto:   沉淀哥
 * Description:
 * Version: V1.0
 */
public class ProductServiceImpl implements ProductService {
    ProductDao productDao=new ProductDaoImpl();

    @Override
    public List<Products> findByPage(Integer productId, String productName, String productCategory,Integer page,Integer limit) {
        if (productName!=null && productName.trim().length()==0){
            productName=null;
        }
        if (productName!=null && productName.trim().length()==0){
            productCategory=null;
        }
        return productDao.findByPage(productId,productName,productCategory,page,limit);
    }

    @Override
    public boolean add(Products products) {
        return productDao.add(products);
    }

    @Override
    public boolean deleteById(Integer id) {
        return productDao.deleteById(id);
    }

    @Override
    public boolean update(Products products) {
        return productDao.update(products);
    }

    @Override
    public Integer maxPage(Integer productId,String productName,String productCategory) {
        return productDao.maxPage(productId,productName,productCategory);
    }
}
